home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Pentominoes 1.4.1 / source / Pentominoes ƒ / Pent code / pent generic open.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.8 KB  |  66 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        pent generic open.c
  4.  
  5. Purpose:    This module handles opening a saved game gotten through
  6.             apple events.
  7.  
  8.  
  9. Pentominoes - a 2-D geometry board game
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "pent generic open.h"
  30. #include "pent load-save.h"
  31. #include "msg graphics.h"
  32. #include "msg dialogs.h"
  33.  
  34. void GenericOpen(FSSpec *myFSS)
  35. {
  36.     HParamBlockRec    paramBlock;
  37.     
  38.     if (gMainWindow==0L)
  39.     {
  40.         paramBlock.fileParam.ioCompletion=0L;
  41.         paramBlock.fileParam.ioNamePtr=myFSS->name;
  42.         paramBlock.fileParam.ioVRefNum=myFSS->vRefNum;
  43.         paramBlock.fileParam.ioFDirIndex=0;
  44.         paramBlock.fileParam.ioDirID=myFSS->parID;
  45.         PBHGetFInfo(¶mBlock, FALSE);
  46.         
  47.         switch (paramBlock.fileParam.ioFlFndrInfo.fdType)
  48.         {
  49.             case 'PBrd':
  50.                 gameFile=*myFSS;
  51.                 GetSavedGame(&gameFile);
  52.                 break;
  53.             case 'TEXT':
  54.                 solutionFile=*myFSS;
  55.                 GetSolution(&solutionFile);
  56.                 break;
  57.         }
  58.     }
  59.     else
  60.     {
  61.         ParamText("\pPlease close the current game before loading a new one.","\p","\p","\p");
  62.         PositionDialog('ALRT', generalAlert);
  63.         Alert(generalAlert, 0L);
  64.     }
  65. }
  66.